home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1998 June / SGI IRIX 6.5 Applications 1998 June.iso / dist / arraysvcs.idb / usr / lib / array / awho.z / awho
Text File  |  1998-04-15  |  550b  |  31 lines

  1. #!/bin/sh
  2. #
  3. # Simple script to implement "array who"
  4. #
  5. # Usage: awho local <name>
  6. #    or: awho merge <file....>
  7. #
  8.  
  9. if [ "$1" = "local" ]; then
  10.  
  11.     w        |\
  12.     tail +3        |\
  13.     nawk 'BEGIN { Host = "'$2'" };         \
  14.         { printf "%-8s %-12s %-14s %s\n", \
  15.              $1, Host, substr($0, 14, 14), substr($0, 59) }'
  16.  
  17. elif [ "$1" = "merge" ]; then
  18.  
  19.     shift 1
  20.     echo "User     Machine      From           What"
  21.     echo "----------------------------------------------------------"
  22.     sort $*
  23.  
  24. else
  25.  
  26.     echo "Usage: awho local <hostname>"
  27.     echo "   or: awho merge <output-file>..."
  28.  
  29. fi
  30.  
  31.